<%@ page import="java.lang.*,java.sql.*,javax.naming.*,javax.sql.*"%>
<%@ page import="entities.SellerEntity"%>
<%@ page language="java"
	import="java.util.*,service.*,java.math.BigDecimal,db.*;"
	pageEncoding="UTF-8"%>
<!DOCTYPE HTML>  
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE1 {
	font-size: 12px
}

.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}

a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}

a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}

a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}

a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}

.STYLE7 {
	font-size: 12
}
-->
</style>

</head>

<%
	Connection con = null;
	Statement stmt = null;
	ResultSet rs = null;
	int pageSize, rowCount = 0, pageCount, curPage;
	pageSize = 5;
	pageCount = 1;
	String strPage = request.getParameter("page");
	String isVerify = request.getParameter("isVerify");
	if (isVerify == null || isVerify.equals("")) {
		isVerify = "1";
	}
	int n = Integer.parseInt(isVerify);

	if (strPage == null)
		curPage = 1;
	else {
		curPage = Integer.parseInt(strPage);//通过参数来定当前页面 
		if (curPage < 1)
			{curPage = 1;}
	}
%>
<%
	try {
		con = DBConn.getConn();
		stmt = con.createStatement();
		String sql = "select * from shop_seller where seller_isVerify = "
				+ n;
		rs = stmt.executeQuery(sql);
		rs.last();
		rowCount = rs.getRow();
		pageCount = (rowCount + pageSize - 1) / pageSize;
		if (curPage > pageCount)
			curPage = pageCount;
	} catch (SQLException e) {
		System.out.println(e.toString());
	}
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()
	+ request.getContextPath();
%>

<body>
	<form id="checkForm" name="checkForm" action="<%=basePath%>/servlet/CheckServlet" method="post">
	<table width="100%" border="0" align="center" cellpadding="0"
		cellspacing="0">
		<tr>
			<td height="30"><table width="100%" border="0" cellspacing="0"
					cellpadding="0">
					<tr>
						<td width="15" height="30"><img src="images/tab_03.gif"
							width="15" height="30" /></td>
						<td width="1101" background="images/tab_05.gif"><img
							src="images/311.gif" width="16" height="16" /> <span
							class="STYLE4"> <%
 	if (n == 1) {
 %> 已审核商家列表 <%
 	} else if(n == 0) {
 %> 未审核商家列表</span></td>
						<td width="181" background="images/tab_05.gif"><table
								border="0" align="right" cellpadding="0" cellspacing="0">
								<tr>
									<td width="60"><table width="87%" border="0"
											cellpadding="0" cellspacing="0">
											<tr>
												<td class="STYLE1"><div align="center">
														<input type="checkbox" name="checkbox62"
															onclick="chooseAll('mycheckbox',this)" value="checkbox" />
													</div></td>
												<td class="STYLE1"><div align="center">全选</div></td>
											</tr>
										</table></td>

									<td width="60"><table width="90%" border="0"
											cellpadding="0" cellspacing="0">
											<tr>
												<td class="STYLE1"><div align="center">
														<img src="images/114.gif" width="14" height="14" />
													</div></td>
												<td class="STYLE1"><div align="center"><a href="#" onclick="checkForm.submit();">审核</a></div></td>
											</tr>
										</table></td>

								</tr>
							</table></td> 
<%
 	}
%> 
						<td width="14"><img src="images/tab_07.gif" width="14"
							height="30" /></td>
					</tr>
				</table></td>
		</tr>
		<tr>
			<td><table width="100%" border="0" cellspacing="0"
					cellpadding="0">
					<tr>
						<td width="9" background="images/tab_12.gif">&nbsp;</td>
						<td bgcolor="#f3ffe3"><table width="99%" border="0"
								align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98">
								<tr>
								<%if(n == 0) {%>
									<td width="5%" height="18" background="images/tab_14.gif"
										class="STYLE1"><br>
									<br>
									</td>
									<%} %>
									<td width="17%" height="18" background="images/tab_14.gif"
										class="STYLE1"><div align="center" class="STYLE2 STYLE1">商家名称</div>
									</td>
									<td width="15%" height="18" background="images/tab_14.gif"
										class="STYLE1"><div align="center" class="STYLE2 STYLE1">电子邮件</div>
									</td>
									<td width="15%" height="18" background="images/tab_14.gif"
										class="STYLE1"><div align="center" class="STYLE2 STYLE1">电话</div>
									</td>
									<td width="10%" height="18" background="images/tab_14.gif"
										class="STYLE1"><div align="center" class="STYLE2 STYLE1">老板</div>
									</td>
									<td width="30%" height="18" background="images/tab_14.gif"
										class="STYLE1"><div align="center" class="STYLE2 STYLE1">地址</div>
									</td>
									<td width="8%" height="10" background="images/tab_14.gif"
										class="STYLE1"><div align="center" class="STYLE2">状态</div>
									</td>

								</tr>
								<%
									if (pageCount > 0)
										rs.absolute((curPage - 1) * pageSize + 1);
									int i = 0;
									while (i < pageSize && !rs.isAfterLast()) {
								%>
								<tr><%if(n == 0){ %>
									<td height="18" bgcolor="#FFFFFF"><div align="center"
											class="STYLE1">
											<input name="mycheckbox" type="checkbox" class="STYLE2"
												value="<%=rs.getInt("seller_id") %>" />
										</div></td>
										<%} %>
									<td height="18" bgcolor="#FFFFFF" class="STYLE2"><div
											align="center" class="STYLE2 STYLE1"><%=rs.getString("seller_name")%></div>
									</td>
									<td height="18" bgcolor="#FFFFFF"><div align="center"
											class="STYLE2 STYLE1"><%=rs.getString("seller_email")%></div>
									</td>
									<td height="18" bgcolor="#FFFFFF"><div align="center"
											class="STYLE2 STYLE1"><%=rs.getString("seller_tel")%></div></td>
									<td height="18" bgcolor="#FFFFFF"><div align="center"
											class="STYLE2 STYLE1"><%=rs.getString("seller_owner")%></div>
									</td>
									<td height="18" bgcolor="#FFFFFF"><div align="center"
											class="STYLE2 STYLE1"><%=rs.getString("seller_addr")%></div>
									</td>
									<td height="18" bgcolor="#FFFFFF"><div align="center">
											<%if(n == 1) {%>
											<span class="STYLE1"> [</span><a href="#">已审核</a><span
												class="STYLE1">]</span>
											<%} else if(n == 0) {%>	
											<span class="STYLE1"> [</span><a href="#">未审核</a><span
												class="STYLE1">]</span>
												<% }%>
										</div></td>

								</tr>
								<%
									rs.next();
										i++;
									}
								%>
							

							</table></td>
						<td width="9" background="images/tab_16.gif">&nbsp;</td>
					</tr>
				</table></td>
		</tr>
		<tr>
			<td height="29"><table width="100%" border="0" cellspacing="0"
					cellpadding="0">
					<tr>
						<td width="15" height="29"><img src="images/tab_20.gif"
							width="15" height="29" /></td>
						<td background="images/tab_21.gif"><table width="100%"
								border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="25%" height="29" nowrap="nowrap"><span
										class="STYLE1">共<%=rowCount%>条纪录，当前第<%=curPage%>/<%=pageCount%>页，每页<%=pageSize%>条纪录</span>
									</td>
									<td width="75%" valign="top" class="STYLE1"><div
											align="right">
											<table width="352" height="20" border="0" cellpadding="0"
												cellspacing="0">
												<tr>
													<td width="62" height="22" valign="middle"><div
															align="right">
															<a href="?page=<%=1%>&isVerify=<%=n %>"> <img src="images/first.gif"
																border="0" width="37" height="15" /> </a>
														</div></td>
													<%
														if (curPage > 1) {
													%>
													<td width="50" height="22" valign="middle"><div
															align="right">
															<a href="?page=<%=curPage - 1%>&isVerify=<%=n %>"> <img
																src="images/back.gif" border="0" width="43" height="15" />
															</a>
														</div></td>
													<%
														}
													%>
													<%
														if (curPage < pageCount) {
													%>
													<td width="54" height="22" valign="middle"><div
															align="right">
															<a href="?page=<%=curPage + 1%>&isVerify=<%=n %>"> <img
																src="images/next.gif" border="0" width="43" height="15" />
															</a>
														</div></td>
													<%
														}
													%>
													<td width="49" height="22" valign="middle"><div
															align="right">
															<a href="?page=<%=pageCount%>&isVerify=<%=n %>"> <img
																src="images/last.gif" border="0" width="37" height="15" />
															</a>
														</div></td>
													<td width="59" height="22" valign="middle"><div
															align="right">转到第</div></td>
													<td width="25" height="22" valign="middle"><span
														class="STYLE7"> <input id="pageNum"
															name="textfield" type="text" class="STYLE1"
															style="height:18px; width:25px;" size="5" /> </span></td>
													<td width="23" height="22" valign="middle">页</td>
													<td width="30" height="22" valign="middle"><a
														onclick="tiaozhuan()" style="cursor: pointer;"> <img
															src="images/go.gif" width="37" height="15" /> </a></td>
												</tr>
											</table>
										</div></td>
								</tr>
							</table></td>
							<%
							rs.close();
							con.close(); %>
						<td width="14"><img src="images/tab_22.gif" width="14"
							height="29" /></td>
					</tr>
				</table></td>
		</tr>
	</table>
	</form>
	<script type="text/javascript">
		function tiaozhuan() {
			var value = document.getElementById("pageNum").value;
			if(isNum(value)){
			document.location = "tab.jsp?page=" + value+"&isVerify=<%=n %>";
			}
			else
			alert("请输入正整数！");
		}

		function isNum(num){  var reNum=/^\d*$/;  return(reNum.test(num));}
		function chooseAll(checkName, selectedNode) {
			var checkBoxs = document.getElementsByName(checkName);
			for ( var i = 0; i < checkBoxs.length; i++) {
				if (!checkBoxs[i].disabled) {
					checkBoxs[i].checked = selectedNode.checked;
				}
			}
		}
	</script>
</body>
</html>
